TQ3ObjectTraverseMethod
You can define a method to traverse a custom object and write its data and the data of any attached subobjects to a file.
typedef TQ3Status (*TQ3ObjectTraverseMethod) ( TQ3Object object, TQ3FileObject file);
object
- A QuickDraw 3D object.
file
- A file object.
DESCRIPTION
YourTQ3ObjectTraverseMethod
method should perform a number of operations necessary to write the object specified by theobject
parameter, as well as any subobjects attached to it, to the file specified by thefile
parameter.First, your traverse method should determine whether the specified object should be written to the file. It's possible that you won't want to write certain types of custom objects or certain types of data associated with a custom object. If you decide not to write the specified object and its subobjects to the file, your traverse method should return
kQ3Success
without calling any_Submit
functions.Next, you should calculate the size on disk of your custom object. This size must be aligned on a 4-byte boundary. Then you should retrieve whatever view state information you need to preserve. The state of the view is not valid in your custom object write method, but it is valid in your traverse method; if you need view state information in your write method, you can pass a temporary buffer to it.
Once you've preserved whatever view state information you need, you should submit your data by calling
Q3View_SubmitWriteData
. Then you should submit subobjects by calling the appropriate_Submit
functions. You must callQ3View_SubmitWriteData
before calling_Submit
functions to submit any subobjects.RESULT CODES
YourTQ3ObjectTraverseMethod
function should returnkQ3Success
if it is successful andkQ3Failure
otherwise.